package com.example.volatileDemo;

/**
 * volatile 初尝试
 */
public class Demo1 {
    private static volatile String a= "a";

    public static void main(String[] args) throws InterruptedException {
        for (int i = 0; i < 10; i++) {
            final int j = i;
            new Thread(() -> a = a + j +"").start();
        }

        Thread.sleep(100);
        System.out.println(a);
    }
}
